#include "cuda_fun.h"
#include <iostream>
#include <vector>

int main() {
    const int size = 1024;
    std::vector<int> a(size), b(size), c(size);

    // 初始化数据
    for (int i = 0; i < size; ++i) {
        a[i] = i;
        b[i] = i;
    }

    // 调用CUDA函数
    cuda_add(a.data(), b.data(), c.data(), size);

    // 验证结果
    bool success = true;
    for (int i = 0; i < size; ++i) {
        if (c[i] != a[i] + b[i]) {
            success = false;
            std::cout << "Error at index " << i << ": "
                << c[i] << " != " << a[i] + b[i] << std::endl;
            break;
        }
    }

    if (success) {
        std::cout << "All results are correct!" << std::endl;
    }

    return 0;
}
